package com.cuit.food.food.Yservice;

import com.cuit.food.Food;
import com.cuit.food.food.Ydao.foodRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.*;

@Service
public class foodservice {
    @Autowired
    foodRepository foodrepository;

    public  List<Food> findAll() {
        return foodrepository.findAll();
    }

    /**
     * 获得大于price菜品表
     * @param price
     * @return
     */
    public List<Food> findByPriceGreaterThan(long price) {
        return foodrepository.findByPriceGreaterThan(price);
    }

    /**
     * 获得小于price菜品表
     * @param price
     * @return
     */
    public List<Food> findByPriceLessThan(long price) {
        return foodrepository.findByPriceLessThan(price);
    }

    /**
     * 获得相同菜品的表
     * @param typename
     * @return
     */
    public List<Food> findSameType(String typename) {

        return foodrepository.findByCatalog(typename);
    }

    public  List<Food> findByCatalogAndPriceLessThanEqual(String typename, long price) {
        return foodrepository.findByCatalogAndPriceLessThanEqual(typename, price);
    }
}
